//
//  Account.h
//  YuchBox
//
//  Created by Ivan on 11-11-10.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "IvanSqliteDB.h"

//#define ACCOUNT_SESSION [Account sharedAccount]
@interface Account : NSObject
{
    UInt64      _uid;
    NSString    *_host;
    NSInteger   _port;
    NSString    *_password;
    
    UInt64      _timestamp;
    Boolean     _isAutoLogin;
}

@property   (assign, nonatomic) UInt64      uid;
@property   (copy, nonatomic)   NSString    *host;
@property   (assign, nonatomic) NSInteger   port;
@property   (copy, nonatomic)   NSString    *password;
@property   (assign, nonatomic) UInt64      timestamp;
@property   (assign, nonatomic) Boolean     isAutoLogin;

//+ (Account *)sharedAccount;
- (id)initSingleton;

- (void)save:(IvanSqliteDB *)con;
+ (void)retrieveAccounts:(IvanSqliteDB *)con accounts:(NSMutableArray *)accounts limit:(NSInteger)limit;

+ (void)retrieveAccount:(IvanSqliteDB *)con account:(Account *)account withPkId:(UInt64)pkId;
+ (void)retrieveAccount:(IvanSqliteDB *)con account:(Account *)account withHost:(NSString *)host withPort:(NSInteger)port withPassword:(NSString *)password;
+ (void)getLastLoginAccount:(IvanSqliteDB *)con account:(Account*)account withTimeoutInterval:(UInt64)timeout;
@end
